import instance from "@/utils/http";
import type { BuMenData } from "@/types";
import type { AxiosPromise } from "axios";

// 增
export const addBumenAPI = (data: BuMenData) => {
    return instance({
        method: 'POST',
        url: '/bumen',
        data: data
    })
}

// 删
export const delBumenAPI = (id: number) => {
    return instance({
        method: 'DELETE',
        url: '/bumen/' + id
    })
}

// 改
export const updateBumenAPI = (id: number, data: BuMenData) => {
    return instance({
        method: 'PUT',
        url: '/bumen/' + id,
        data: data
    })
}

// 查
export const getBumenAPI = (params: any): AxiosPromise<BuMenData[]> => {
    return instance({
        method: 'GET',
        url: '/bumen',
        params: params
    })
}